package com.ruoyi.platform.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.platform.mapper.UserComplaintsHandleMapper;
import com.ruoyi.platform.domain.UserComplaintsHandle;
import com.ruoyi.platform.service.IUserComplaintsHandleService;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.SecurityUtils;

/**
 * 用户售后处理Service业务层实现
 */
@Service
public class UserComplaintsHandleServiceImpl implements IUserComplaintsHandleService {
    @Autowired
    private UserComplaintsHandleMapper userComplaintsHandleMapper;

    @Override
    public UserComplaintsHandle selectUserComplaintsHandleByComplaintId(String complaintId) {
        return userComplaintsHandleMapper.selectUserComplaintsHandleByComplaintId(complaintId);
    }

    @Override
    public List<UserComplaintsHandle> selectComplaintsAuditList(UserComplaintsHandle userComplaintsHandle) {
        return userComplaintsHandleMapper.selectComplaintsAuditList(userComplaintsHandle);
    }

    @Override
    public int insertUserComplaintsHandle(UserComplaintsHandle userComplaintsHandle) {
        return userComplaintsHandleMapper.insertUserComplaintsHandle(userComplaintsHandle);
    }

    @Override
    public int updateUserComplaintsHandle(UserComplaintsHandle userComplaintsHandle) {
        return userComplaintsHandleMapper.updateUserComplaintsHandle(userComplaintsHandle);
    }

    @Override
    public int handleComplaint(UserComplaintsHandle userComplaintsHandle) {
        // 设置当前登录用户为处理人
        SysUser loginUser = SecurityUtils.getLoginUser().getUser();
        userComplaintsHandle.setHandlerId(loginUser.getUserId().toString());
        return userComplaintsHandleMapper.updateComplaintStatus(userComplaintsHandle);
    }

    @Override
    public int deleteUserComplaintsHandleByComplaintId(String complaintId) {
        return userComplaintsHandleMapper.deleteUserComplaintsHandleByComplaintId(complaintId);
    }

    @Override
    public int deleteUserComplaintsHandleByComplaintIds(String[] complaintIds) {
        return userComplaintsHandleMapper.deleteUserComplaintsHandleByComplaintIds(complaintIds);
    }
}